<?php

namespace app\common\model\meet\article;

use think\Model;


class Article extends Model
{


    // 表名
    protected $name = 'meet_article';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'createtime_text'
    ];

    const STATUS_HIDDEN = 'hidden';

    const STATUS_NORMAL = 'normal';

    public function getImageAttr($value)
    {
        return $value ? cdnurl($value, true) : '';
    }

    public function getCreatetimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['createtime']) ? $data['createtime'] : '');
        return is_numeric($value) && !empty($value) ? date("Y-m-d H:i:s", $value) : '';
    }
}
